//
//  AdvertModel.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/7/11.
//  Copyright © 2016年 wl. All rights reserved.
//

import Foundation
import SwiftyJSON

class ADImageModel: NewsModelInitProtocol {
    var msg: String
    var imgsrc: String
    var timelength: String
    var url: String
    
    required init(json: JSON) {
        msg = json["msg"].stringValue
        imgsrc = json["imgsrc"].stringValue
        timelength = json["timelength"].stringValue
        url = json["url"].stringValue
    }
}
class AdvertPictureModel: NewsModelInitProtocol {
    var id: Int
    var imgsrc: String
    var url: String
    var type: String
    var adsorder: Int
    
    required init(json: JSON) {
        id = json["id"].intValue
        imgsrc = json["imgsrc"].stringValue
        url = json["url"].stringValue
        type = json["type"].stringValue
        adsorder = json["adsorder"].intValue
    }
}

class AdvertModel: NewsModelInitProtocol {
    var pictureList: [AdvertPictureModel]
    var dropDownList: [[String]] = []
    
    required init(json: JSON) {
        pictureList = ModelArrayProvider.arrayModel(AdvertPictureModel.self, json: json["ads"])!
        
        let ddList = json["dropdown"]
        for (_, item) in ddList {
            var list: [String] = []
            for (_, inItem) in item {
                list.append(inItem.stringValue)
            }
            dropDownList.append(list)
        }
    }
}